﻿using System;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace InheritanceVsCoupling
{
    class Program
    {
        static void Main(string[] args)
        {
            var logger = new FileLogger(@"C:\My Files\log.txt");
            MailService mail = new MailService(logger);
            VacationService calculator = new VacationService(logger);

            mail.SendMails(null, "Hello");
            calculator.CalculateDaysLeft("mevsukov@intetics.com");

        }
    }

    interface ILogger
    {
        void Log(string message);
    }

    class ConsoleLogger : ILogger
    {
        public void Log(string message)
        {
            Console.WriteLine(message + " " + DateTime.Now);
        }
    }

    class FileLogger : ILogger
    {
        private readonly string _path;

        public FileLogger(string path)
        {
            _path = path;
        }

        public void Log(string message)
        {
            using (StreamWriter writer = new StreamWriter(_path, true))
            {
                writer.WriteLine(message+ " " + DateTime.Now);
            }
        }
    }

}


